<?
  include_once ("include/ini.php");

  $sale_ar = $c_adv -> SelectAdv(1,1);
  $buy_ar = $c_adv -> SelectAdv(2,1);
  $rssnews1_ar = $c_news -> SelectRssNews(0,5);
  $rssnews2_ar = $c_news -> SelectRssNews(5,5);

  include_once "questions.php";

  include_once "include/auth_bridge.php";
  include_once "include/wetter_inc.php";

  ?>
<SCRIPT TYPE="text/javascript">
function changeAdv() {
     var AdvOptions1 = document.getElementById('AdvOptions1');
     var AdvOptions2 = document.getElementById('AdvOptions2');
     if (AdvOptions1.style.display == 'none')
	    AdvOptions1.style.display = 'inline';
	 else if (AdvOptions1.style.display == 'inline')
	    AdvOptions1.style.display = 'none';
     if (AdvOptions2.style.display == 'none')
	    AdvOptions2.style.display = 'inline';
	 else if (AdvOptions2.style.display == 'inline')
	    AdvOptions2.style.display = 'none';
}

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600,height=500,scrollbars=yes,resizable=yes');
return false;
}
</script>
<?
  // journals

	$journalsAr = $c_journal->selectJournals(10);
	$journalsCount = count($journalsAr);
	for ($i=0; $i<$journalsCount; $i++)
	{
		$journalsAr[$i]['date'] = $c_all->convertTime($journalsAr[$i]['date']);
		$journalsAr[$i]['commentsCount'] = count($c_journal->selectComments($journalsAr[$i]['id']));
	}

	$smarty -> assign('journalsAr', $journalsAr);

  $lastPosts = $c_phpbb->lastPosts();
  $lastSales = $c_phpbb->lastPosts(5, array(3));

  include_once ("include/close_connect_inc.php");
  
  $smarty -> assign('advph_dir',$advph_dir);
  $smarty -> assign('sale_ar',$sale_ar);
  $smarty -> assign('buy_ar',$buy_ar);
  $smarty -> assign('rssnews1_ar',$rssnews1_ar);
  $smarty -> assign('rssnews2_ar',$rssnews2_ar);
  
  $smarty -> assign('last_posts',$lastPosts);
  $smarty -> assign('last_sales',$lastSales);
   
  $smarty -> display('site/index.tpl');
?>